// -*- mode: Scala;-*- 
// Filename:    REPL.scala 
// Authors:     lgm                                                    
// Creation:    Thu May  8 10:18:48 2008 
// Copyright:   Not supplied 
// Description: 
// ------------------------------------------------------------------------

package com.biosimilarity.GraphL.model

import com.biosimilarity.GraphL.model.GraphL._
import java.io.StringReader

trait REPLTemplate[ParseTree] {
  var inputStream : java.io.StringReader = null
  var _cmdParseTree : Option[ParseTree] = None

  def lexer () = new Yylex(inputStream)
  def lexer (str : String) = new Yylex(new StringReader(str))
  def parser () = new parser(lexer())
  def parser (str : String) = new parser(lexer(str))
  def clientRequestParseTree () = (parser()).pGraphExpr()
  def clientRequestParseTree (str : String) = (parser(str)).pGraphExpr()

  def read (str : String) = clientRequestParseTree(str)
  def showClientRequestParseTree () = PrettyPrinter.show(clientRequestParseTree())
  def showClientRequestParseTree (str : String) = PrettyPrinter.show(clientRequestParseTree(str))

}
